require('../../common/vendor.js');import {
    getTypeList,
    getInfoList
} from "@/pages/achievement/api/common.js";

//  获取年纪考试类型
const getInfoTypeList = async (type) => {
    const searchParams = {
        pageNo: 1,
        pageSize: 100,
        typeId: "",
    }
    let typeOptions = []
    const data = await getTypeList()
    typeOptions = data?.data?.list.filter(item => item.typeName == type)
        .map(item => ({
            label: item.typeName,
            value: item.typeId
        }))
    searchParams.typeId = typeOptions[0].value
    const typeInfo = {
        typeName: typeOptions[0].label,
        typeId: typeOptions[0].value
    }
    let infoList = []
    try {
        const data = await getInfoList(searchParams);
        infoList = [...data?.data?.list]

        return {
            typeInfo,
            infoList
        }
    } catch (error) {
        console.log(error)
    }
}



export {
    getInfoTypeList
}
